import { Component } from 'react'

export default class Childs extends Component {
  state = {
    wife: '',
  }
  render() {
    return (
      <div>
        <h3>我是子组件</h3>
        <div>父亲的名字：{this.props.parent}</div>
        配偶：
        <input
          type='text'
          value={this.state.wife}
          onChange={this.handlechange}
        />
        <hr />
      </div>
    )
  }
  handlechange = (e) => {
    this.setState({ wife: e.target.value })
    this.props.changeName(e.target.value)
  }
}
